﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Himp.Platform.Migrations
{
    /// <inheritdoc />
    public partial class modif_table_column_TopicDictId : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MainStdTableDict_MainTopicDict_TopicConfigId",
                table: "MainStdTableDict");

            migrationBuilder.RenameColumn(
                name: "TopicConfigId",
                table: "MainStdTableDict",
                newName: "TopicDictId");

            migrationBuilder.RenameIndex(
                name: "IX_MainStdTableDict_TopicConfigId",
                table: "MainStdTableDict",
                newName: "IX_MainStdTableDict_TopicDictId");

            migrationBuilder.AddForeignKey(
                name: "FK_MainStdTableDict_MainTopicDict_TopicDictId",
                table: "MainStdTableDict",
                column: "TopicDictId",
                principalTable: "MainTopicDict",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MainStdTableDict_MainTopicDict_TopicDictId",
                table: "MainStdTableDict");

            migrationBuilder.RenameColumn(
                name: "TopicDictId",
                table: "MainStdTableDict",
                newName: "TopicConfigId");

            migrationBuilder.RenameIndex(
                name: "IX_MainStdTableDict_TopicDictId",
                table: "MainStdTableDict",
                newName: "IX_MainStdTableDict_TopicConfigId");

            migrationBuilder.AddForeignKey(
                name: "FK_MainStdTableDict_MainTopicDict_TopicConfigId",
                table: "MainStdTableDict",
                column: "TopicConfigId",
                principalTable: "MainTopicDict",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
